import { defineStore } from 'pinia'
import cartApi from '@/api/cart'
import type { cartInfoListModel } from '@/api/cart'

interface cartDataListModel {
    cartDataList: cartInfoListModel[]
}

const useCartStore = defineStore('cartStore', {
    state(): cartDataListModel {
        return {
            cartDataList: []
        }
    },
    actions: {
        async getCartList() {
            try {
                let result = await cartApi.reqCartList()
                console.log('result', result);
                this.cartDataList = result[0].cartInfoList
            } catch (error) {
                console.log(error);
                
            }
        }
    },
    getters: {}
})

export default useCartStore